package flinkdemo.faceSink;

import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.java.operators.DataSource;
import org.apache.flink.core.fs.FileSystem;

import java.util.ArrayList;
import java.util.List;

/**
 * 本地执行
 */
public class JavaImageSink {

    public static void main(String[] args) throws Exception {

       // String host = "master";
        //int port = 8081;
      //  String jarFiles = "E:\\code\\ideawork\\hadoopone\\target\\hadoopone-0.0.1-SNAPSHOT.jar";
        //  StreamExecutionEnvironment env = StreamExecutionEnvironment.createRemoteEnvironment(host, port, jarFiles);
        ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
        List<Integer> info = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            info.add(i);
        }

        String filePath = "E:\\code\\ideawork\\hadoopone\\src\\main\\resources\\sink\\java\\sink_test.txt";
        DataSource<Integer> data = env.fromCollection(info);
        data.writeAsText(filePath, FileSystem.WriteMode.OVERWRITE);

        env.execute("JavaDataSetSinkApp");
    }
}